const lodash = require('lodash');
const model = {

    init(tablename, types, column) {
        let camelCaseTableName = lodash.camelCase(tablename);
        camelCaseTableName = lodash.upperFirst(camelCaseTableName);
        let sqModel = 
`'use strict';

module.exports = app => {
\tconst { ${types} } = app.Sequelize;

\tconst ${camelCaseTableName} = app.model.define('${tablename}', {
${column} 
\t},{
\t//防止查询在表名后加s
\tfreezeTableName:true,
\t//是否自动创建create_at
\ttimestamps:false
\t});

return ${camelCaseTableName};
};`;
        return sqModel;
    }

}

module.exports = model;